#!/usr/bin/env python

from django.http import HttpResponseRedirect,HttpResponse

class AuthenticationMiddleware(object):
    def process_request(self,request):
        path = str(request.path)
        if path.startswith('/login'):
            return None
        elif path.startswith('/monitor/status'):
            return None
        elif request.user.is_anonymous():
            return HttpResponseRedirect('/login')
        else:
            return None
